package com.shopmall.service;

import com.shopmall.mapper.UserMapper;
import com.shopmall.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService{
    @Autowired
    UserMapper UserMapper;

    @Override
    public List<User> queryUserList(){
        return  UserMapper.queryUserList();
    }

    @Override
    public User queryUserById(int id){
        return UserMapper.queryUserById(id);
    }

    @Override
    public User queryUserByUsername(String username){
        return UserMapper.queryUserByUsername(username);
    }

    @Override
    public int addUser(User user){
        return UserMapper.addUser(user);
    }

    @Override
    public int updateUser(User user){
        return UserMapper.updateUser(user);
    }

    @Override
    public int deleteUser(int id){
        return UserMapper.deleteUser(id);
    }
}

